/**
 * 
 */
package com.skood.platform.webapp.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.skood.common.domain.EntityBean;
import com.skood.common.model.SearchModel;
import com.skood.common.service.CommonService;

/**
 * @author keege
 * @date 2013-12-13
 */
public abstract class AppBaseAction<T extends SearchModel<E>,E extends EntityBean> extends BaseAction<T,E> {
	private static final long serialVersionUID = 1L;

	public String doJsonList()throws Exception{
		List<E> resultList = getService().search(searchModel, null);
		Long total = getService().searchCount(searchModel, null);
		
		Map<String,Object> resultMap = new HashMap<String,Object>();
		resultMap.put("success", true);
		resultMap.put("rows", resultList);
		resultMap.put("total", total);
		
		writeJson(resultMap);
		return null;
	}
	public abstract CommonService<E> getService();
}
